package com.ztesoft.huangfu.learning.springboot.es.document;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * Created with IntelliJ IDEA.
 * Author: huangfu.daohui
 * Date: 2018/12/18
 * Time: 19:40
 * Version: 1.0
 * studentIndex.json中设置了属性的分词、类型等；也可以在字段上设置
 * index –> DB
 * type –> Table
 * Document –> row
 **/
@Document(indexName = "peoples", type = "student")
//@Mapping(mappingPath = "studentIndex.json")
public class StudentDoc {

    @Id
    private String id;

    @Field(type = FieldType.Text)
    private String name;

    @Field(type = FieldType.Text)
    private String sex;

    @Field(type = FieldType.Long)
    private int age;

    @Field(type = FieldType.Boolean)
    private boolean inSchoolFlag;

    @Field(type = FieldType.Text)
    private String homeTown;

    @Field(type = FieldType.Long)
    private long telNo;

    // 设置时间格式
    @Field(type = FieldType.Long, format = DateFormat.date_hour_minute_second_fraction)
    private long birthday;

    @Field(type = FieldType.Text)
    private String describe;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isInSchoolFlag() {
        return inSchoolFlag;
    }

    public void setInSchoolFlag(boolean inSchoolFlag) {
        this.inSchoolFlag = inSchoolFlag;
    }

    public String getHomeTown() {
        return homeTown;
    }

    public void setHomeTown(String homeTown) {
        this.homeTown = homeTown;
    }

    public long getTelNo() {
        return telNo;
    }

    public void setTelNo(long telNo) {
        this.telNo = telNo;
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }

    public long getBirthday() {
        return birthday;
    }

    public void setBirthday(long birthday) {
        this.birthday = birthday;
    }
}
